import request from '@/utils/request'

const baseURL = '/api/student'

export function getStudentList({
  page, pageSize, params = {}, data
}) {
  return request({
    url: baseURL + '/list',
    method: 'post',
    params: {
      page, pageSize,
      ...params
    }, data
  })
}

export function getOneStudent(id) {
  return request({
    url: baseURL + `/${id}`,
    method: 'get'
  })
}

export function addStudent(data) {
  return request({
    url: baseURL,
    method: 'post',
    data
  })
}

export function updateStudent(id, data) {
  return request({
    url: baseURL + `/${id}`,
    method: 'put',
    data
  })
}

export function deleteOneStudent(id) {
  return request({
    url: baseURL + `/${id}`,
    method: 'delete',
  })
}

export function resetStudentPassword(id) {
  return request({
    url: baseURL + `/resetPassword/${id}`,
    method: 'put'
  })
}
